<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <!--<s:head/>-->
    <title>登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	
	<link href="${pageContext.request.contextPath}/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<link href="${pageContext.request.contextPath}/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
	<link href="${pageContext.request.contextPath}/css/bootstrap-social.css" rel="stylesheet" type="text/css">	
	<link href="${pageContext.request.contextPath}/css/templatemo_style.css" rel="stylesheet" type="text/css">	
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
	  	<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<script type="text/javascript">
  	
    $(document).ready(function () {
        $("#submitbutton").click(function () {
       // var datastring="user.ualais="+$("#user\\.ualais").val()+"&"+"user.upassword="+$("#user\\.upassword").val();
            var options = {
                url: 'login.action',
                type: 'post',
                dataType: 'text',
                data:$("#loginform").serialize(),
                success: function (responsedata) {
                    //if (responsedata.length > 0)
                       // $("#responseText").text(responsedata);
                    $('#myModal').modal('show');
                    if(responsedata=="3"){//登录成功
                    	 function jump(count) { 
                			window.setTimeout(function(){ 
                    			count--; 
                    			if(count > 0) { 
                       				$("#printcontent").html("<p class='bg-success'>登录成功，将在"+count+"秒后进入首页</p>"); 
                        			jump(count); 
                    			} else { 
                        			location.href="p_index.action"; 
                    			} 
                			}, 1000); 
           				 } 
            		jump(3); 
                    }
                    if(responsedata=="4"){
                    	$("#printcontent").html("<p class='bg-danger'>登录失败，用户名或密码错误</p>");
                    }
                }
            };
            $.ajax(options);
            return false;
        });
    });
  	
  </script>
  </head>
<body class="templatemo-bg-image-1">
	<div class="container">
		<div class="col-md-12">	
		<div class="modal fade" id="myModal"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
   				<div class="modal-dialog">
      				<div class="modal-content">
         				<div class="modal-header">
            				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                  					×
            				</button>
            				<h4 class="modal-title" id="myModalLabel">提示</h4>
       					</div>
         				<div class="modal-body" id="printcontent"></div>
         				<div class="modal-footer">
            				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
         				</div>
      				</div><!-- /.modal-content -->
				</div><!-- /.modal -->
			</div>			
			<form id="loginform" class="form-horizontal templatemo-login-form-2" role="form"  method="post">
				<div class="row">
					<div class="col-md-12">
						<h1>欢迎来到乐淘</h1>
					</div>
				</div>
				<div class="row">
					<div class="templatemo-one-signin col-md-6">
				        <div class="form-group">
				          <div class="col-md-12">		          	
				            <label for="user.ualais" class="control-label">用户名</label>
				            <div class="templatemo-input-icon-container">
				            	<i class="fa fa-user"></i>
				            	<input type="text" class="form-control" id="user.ualais" name="user.ualais" placeholder="">
				            </div>		            		            		            
				          </div>              
				        </div>
				        <div class="form-group">
				          <div class="col-md-12">
				            <label for="user.upassword" class="control-label">密码</label>
				            <div class="templatemo-input-icon-container">
				            	<i class="fa fa-lock"></i>
				            	<input type="password" class="form-control" id="user.upassword" name="user.upassword" placeholder="">
				            </div>
				          </div>
				        </div>
				        <div class="form-group">
				          <div class="col-md-12">
				            <div class="checkbox">
				                <label>
				                  <input type="checkbox"> 记住我
				                </label>
				            </div>
				          </div>
				        </div>
				        <div class="form-group">
				          <div class="col-md-12">
				            <input type="submit" id="submitbutton" value="登录" class="btn btn-warning">
				          </div>
				        </div>
				        <div class="form-group">
				          	<div class="col-md-12">
				        		<a href="forgot-password.html" class="text-center">忘记密码？</a>
				       	 	</div>
				    	</div>
					</div>
					<div class="templatemo-other-signin col-md-6">
						<label class="margin-bottom-15">
							使用其它账号一键登录
						</label>
						<a class="btn btn-block btn-social btn-facebook margin-bottom-15">
						    <i class="fa fa-facebook"></i> 使用Facebook登陆
						</a>
						<a class="btn btn-block btn-social btn-twitter margin-bottom-15">
						    <i class="fa fa-twitter"></i> 使用Twitter登陆
						</a>
						<a class="btn btn-block btn-social btn-google-plus">
						    <i class="fa fa-google-plus"></i> 使用Google登陆
						</a>
					</div>   
				</div>				 	
		      </form>
		      		      	      		      
		</div>
	</div>
</body>

</html>
